#ifndef CNC_NUMBER_H
#define CNC_NUMBER_H

#include "gnumfmt.h"

class GCodeNumber : public GCodeNumberFormat
{
	bool fraction_;
public:
	GCodeNumber(long int int32 = 0)
		: GCodeNumberFormat(int32)
	{
	}
	bool addDigit(unsigned char digit)
	{
		if (significand_ >= 10000000 || -significand_ >= 10000000)
			return false;
		significand_ *= 10;
		significand_ += (significand_ >= 0) ? digit : -digit;
		if (exponent_ > 0)
			exponent_++;
		return true;
	}
	void beginFraction()
	{
		exponent_ = 1;
	}
	void negate()
	{
		significand_ = -significand_;
	}
};

#endif
